package com.hellpro.lolbox.home.hero;

import android.content.Context;

import com.hellpro.lolbox.bean.Hero_All;
import com.hellpro.lolbox.config.UrlConfigs;
import com.hellpro.lolbox.home.HomeJsonUtils;
import com.hellpro.lolbox.utils.OkHttpClientUtils;

import org.greenrobot.eventbus.EventBus;

import java.io.IOException;

/**
 * Package_Name: com.hellpro.lolbox.home.hero
 * Description :
 * author: HellPermanent
 * date:  2016/10/24 19:27
 * remarks：
 */
public class DownHeroData {
private  Context mContext;
    public  DownHeroData(Context context){
        mContext =context;
             Down();
    }
    private  void Down(){
        final String allhero = UrlConfigs.ALLHERO;
 new Thread(new Runnable() {
     @Override
     public void run() {
         try {
             String json = OkHttpClientUtils.getStringFromURL(mContext, allhero, null);
             Hero_All data = HomeJsonUtils.getData(json, Hero_All.class);
             EventBus.getDefault().post(data);

         } catch (IOException e) {
             e.printStackTrace();
         }
     }
 }).start();

    }
}
